package com.wanggsx.library.base.views.scrollViews;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

/**
 * Created by wangweigang on 16/11/23.
 */
public class MyScrollTextView extends TextView implements ForceScrollListener {

    private int initXLeft = 0;
    private int initXRight = 0;
    private boolean isInited = false;

    public MyScrollTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void mustScrollTo(int distance) {
        if (!isInited) {
            isInited = true;
            initXLeft = getLeft();
            initXRight = getRight();
        }
        layout(initXLeft + distance, getTop(), initXRight + distance, getBottom());
    }
}
